@potch/html-bin 1.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +28 -1
- package/build/index.min.js +1 -1
- package/build/index.min.js.gz +0 -0
- package/build/index.min.js.map +1 -1
- package/package.json +5 -6
- package/src/index.js +129 -96
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Potch
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
1
|
# html-bin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
a codebin widget for embeddable editable live demos built on top of [CodeMirror](https://codemirror.net/)
|
|
4
|
+
|
|
5
|
+
## API
|
|
6
|
+
|
|
7
|
+
### `createBin`
|
|
8
|
+
|
|
9
|
+
create a bin component.
|
|
10
|
+
|
|
11
|
+
Options:
|
|
12
|
+
|
|
13
|
+
- `container` (optional Element): will automatically append the bin if provided
|
|
14
|
+
- `sources`: object with optional `{ js, css, html }` strings of source to put
|
|
15
|
+
in the corresponding editors
|
|
16
|
+
- `split`: number from [0, 1] specifying the ratio between the editor and
|
|
17
|
+
preview panes. defaults to `0.5`
|
|
18
|
+
- `width`: CSS string to override default `--bin-width` value. defaults to `100%`
|
|
19
|
+
- `height`: CSS string to override default `--bin-height` value. defaults to `512px`
|
|
20
|
+
|
|
21
|
+
Returns object with the following fields:
|
|
22
|
+
|
|
23
|
+
- `el`: Element of the outermost HTML element of the bin
|
|
24
|
+
- `editors`: contains `{ js, css, html }` properties with the CodeMirror
|
|
25
|
+
instances for each editor tab
|
|
26
|
+
- `activeTab`: a signal representing the currently active editor tab
|
|
27
|
+
- `start`: call this function if you did not provide the `container` option
|
|
28
|
+
after attaching `el` to the DOM
|
|
29
|
+
- `teardown`: call this if you are removing and destroying the bin to
|
|
30
|
+
disconnect all listeners
|